package cn.opopopo.design_pattern_learn.行为型.责任链;

// 6. 客户端测试类
public class ChainOfResponsibilityDemo {
    public static void main(String[] args) {
        // 构建责任链
        Approver teamLeader = new TeamLeader();
        Approver deptManager = new DepartmentManager();
        Approver director = new Director();

        teamLeader.setNextApprover(deptManager);
        deptManager.setNextApprover(director);

        // 发起请求
        LeaveRequest request1 = new LeaveRequest("张三", 2);
        LeaveRequest request2 = new LeaveRequest("李四", 5);
        LeaveRequest request3 = new LeaveRequest("王五", 10);
        LeaveRequest request4 = new LeaveRequest("赵六", 40);

        teamLeader.processRequest(request1); // 组长处理
        teamLeader.processRequest(request2); // 部门经理处理
        teamLeader.processRequest(request3); // 总监处理
        teamLeader.processRequest(request4); // 被拒绝
    }
}